<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Ajax Support</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
	<script>
		/*
		 *  prototype 中 Ajax对象是一个预定义对象,封装了XmlHttpRequest对象的一些操作
		 */
		function searchSales()
		{
			var empID = $F('lstEmployees');
			var y = $F('lstYears');
			var url = 'http://yoursever/app/get_sales';
			var pars = 'empID=' + empID + '&year=' + y;
			
			var myAjax = new Ajax.Request(
			url,
			{
			method: 'get',
			parameters: pars,
			onComplete: showResponse
			});
		}
		function showResponse(originalRequest)
		{
			//put returned XML in the textarea
			$('result').value = originalRequest.responseText;
		}
	</script>
  </head>
  
  <body>
    <select id="lstEmployees" size="10" onchange="searchSales()">
		<option value="5">Buchanan, Steven</option>
		<option value="8">Callahan, Laura</option>
		<option value="1">Davolio, Nancy</option>
	</select>
	<select id="lstYears" size="3" onchange="searchSales()">
		<option selected="selected" value="1996">1996</option>
		<option value="1997">1997</option>
		<option value="1998">1998</option>
	</select>
	<br><textarea id=result cols=60 rows=10 ></textarea>
    
  </body>
</html>
